package com.foreknow.demo5;

public class MyDate {
    private int year;
    private int month;
    private int day;
    public MyDate(){

    }
    public MyDate(int year, int month, int day){
        this.day = day;
        this.month = month;
        this.year = year;
    }

    public void toDateString(){
        if (getMonth() > 0 && getMonth() <= 12&&getDay()>0){
            if (getMonth() == 1&&getMonth()==3&&getMonth() == 5&&getMonth()==7&&getMonth() == 10&&getMonth()==12 && getDay()<=30)
                System.out.println(getYear()+"年"+getMonth()+"月"+getDay()+"日");
            else if (getMonth() == 4&&getMonth()==6&&getMonth() == 9&&getMonth()==11&& getDay()<=31)
                System.out.println(getYear()+"年"+getMonth()+"月"+getDay()+"日");
            else if (getMonth() == 2 && getDay()<28)
                System.out.println(getYear()+"年"+getMonth()+"月"+getDay()+"日");

        }
        System.out.println("年龄输入错误！");
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }

    public int getDay() {
        return day;
    }

    public void setDay(int day) {
        this.day = day;
    }
}
